<template>
    <p>姓名是{{ name }}</p>
    <button @click="name='李四'">改名李四</button>
</template>

<script setup>
import { computed, ref } from 'vue';
const firstName = ref('奕')
const familyName = ref('张');
const name = computed({
    get(){
        return familyName.value+firstName.value
    },
    set(newName){
        familyName.value=newName[0];
        firstName.value=newName[1];
    }
})
</script>

<style scoped>

</style>